#region Microsoft Public License
/*
 * (c) Copyright Chenjun Wu. http://utablesdk.codeplex.com
 * 
 * This source is subject to the Microsoft Public License (Ms-PL).
 * Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
 * All other rights reserved.
 */
#endregion

﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;

namespace UTable.Objects.Controls
{
    internal class UContentPresenterImpl: ControlBaseImpl
    {
        private ContentPresenter _owner;
        private IControl _child = null;

        internal void OnContentChanged(object oldValue, object newValue)
        {
            /*
            if (_child != null)
            {
                Info.Children.Remove(_child.Info);
                _child.Info.Parent = null;
            }
            if (_owner.Content is IControl)
            {
                Info.Children.Add((this._owner.Content as IControl).Info);
                (this._owner.Content as IControl).Info.Parent = Info;
                _child = _owner.Content as IControl;
            }*/

        }

        public void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved)
        {
			/*
            if (visualAdded != null && visualAdded is IControl)
            {
                this.Info.Children.Add((visualAdded as IControl).Info);
                (visualAdded as IControl).Info.Parent = Info;
            }
            if (visualRemoved != null && visualRemoved is IControl)
            { 
                this.Info.Children.Remove((visualRemoved as IControl).Info);
                (visualRemoved as IControl).Info.Parent = null;
            }*/

        }

        internal new static void OverrideMetadata(Type type)
        {
            UControlImpl.OverrideMetadata(type);
            // OverrideMetadata(ContentPresenter.ContentProperty, type);
        }

        internal UContentPresenterImpl(ContentPresenter owner)
            : base(owner)
        {
            _owner = owner;
        }
    }
}
